import java.util.TreeMap;

public class threadlocal {
    static ThreadLocal<String> threadLocal = new ThreadLocal<>();

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
                threadLocal.set("111");
                System.out.println(threadLocal.get()+" 111");
                threadLocal.remove();
        });
        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                threadLocal.set("222");
                System.out.println(threadLocal.get());
                threadLocal.remove();
            }
        });
        thread.start();
        Thread.sleep(10);
        thread1.start();
    }
}
